using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class GroupProductsDAL : SqlDataProvider	{		#region[GroupProducts_GetById]		public List<GroupProducts> GroupProducts_GetById(string Id)		{			List<Data.GroupProducts> list = new List<Data.GroupProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_GetById", GetConnection()))			{				Data.GroupProducts obj = new Data.GroupProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[GroupProducts_GetByTop]		public List<GroupProducts> GroupProducts_GetByTop(string Top, string Where, string Order)		{			List<Data.GroupProducts> list = new List<Data.GroupProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_GetByTop", GetConnection()))			{				Data.GroupProducts obj = new Data.GroupProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[GroupProducts_GetByAll]		public List<GroupProducts> GroupProducts_GetByAll(string Lang)		{			List<Data.GroupProducts> list = new List<Data.GroupProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_GetByAll", GetConnection()))			{				Data.GroupProducts obj = new Data.GroupProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[GroupProducts_Paging]		public List<GroupProducts> GroupProducts_Paging(string CurentPage, string PageSize, string Lang)		{			List<Data.GroupProducts> list = new List<Data.GroupProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_Paging", GetConnection()))			{				Data.GroupProducts obj = new Data.GroupProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		    return list;		}		#endregion		#region[GroupProducts_Insert]		public bool GroupProducts_Insert(GroupProducts data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));				dbCmd.Parameters.Add(new SqlParameter("@Level", data.Level));				dbCmd.Parameters.Add(new SqlParameter("@Title", data.Title));				dbCmd.Parameters.Add(new SqlParameter("@Description", data.Description));				dbCmd.Parameters.Add(new SqlParameter("@Keyword", data.Keyword));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("GroupProducts");			return true;		}		#endregion		#region[GroupProducts_Update]		public bool GroupProducts_Update(GroupProducts data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_Update", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));				dbCmd.Parameters.Add(new SqlParameter("@Level", data.Level));				dbCmd.Parameters.Add(new SqlParameter("@Title", data.Title));				dbCmd.Parameters.Add(new SqlParameter("@Description", data.Description));				dbCmd.Parameters.Add(new SqlParameter("@Keyword", data.Keyword));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("GroupProducts");			return true;		}		#endregion		#region[GroupProducts_Delete]		public bool GroupProducts_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_GroupProducts_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("GroupProducts");			return true;		}		#endregion			}}